package com.gopay.cron.service.cloud.gen.bean;

import com.gopay.cron.web.vo.CloudAccountStatementVO;

/** 
 * @ClassName: CloudRecvFileInfo 
 * @Description: 云账户收款类对账文件信息
 * @author liuxuyang
 * @date 2018年3月15日 下午3:13:38  
 */

public class CloudRecvFileInfo {
	
	public static final String fileFtpName = "收款类";
	
	private static final String csvFtpFirstLine = "\"商户账户\",\"收款总笔数\",\"收款总金额\",\"收款总手续费\"";
    private static final String csvFtpSecondLine = "\"国付宝交易号\",\"商户订单号\",\"交易类型\",\"交易时间\",\"完成时间\",\"交易金额\",\"手续费\",\"支付渠道\",\"分账类型\",\"分账状态\"";

	private StringBuilder csvFtpFirstLineContent = new StringBuilder();
    private StringBuilder csvFtpSecondLineContent = new StringBuilder();
    
    public void addFtpFirstRecvFileLine(CloudAccountStatementVO vo) {
        addFtpFirstCsvFileLine(vo);
    }
    
    private void addFtpFirstCsvFileLine(CloudAccountStatementVO vo) {
        csvFtpFirstLineContent.append("\"").append(vo.getGopayAcct()).append("\",")
                .append("\"").append(vo.getTotalCount()).append("\",")
                .append("\"").append(vo.getTotalTxnAmt()).append("\",")
                .append("\"").append(vo.getTotalFeeAmt()).append("\"")
                .append("\r\n");
    }
    
    public void addFtpSecondRecvFileLine(CloudAccountStatementVO vo) {
        addFtpSecondCsvFileLine(vo);
    }
    
    private void addFtpSecondCsvFileLine(CloudAccountStatementVO vo) {
        csvFtpSecondLineContent.append("\"").append(vo.getGopayOrderId()).append("\",")
                .append("\"").append(vo.getMerOrderId()).append("\",")
                .append("\"").append(vo.getGopayIntTxnCd()).append("\",")
                .append("\"").append(vo.getReqTime()).append("\",")
                .append("\"").append(vo.getTranFinishTime()).append("\",")
                .append("\"").append(vo.getMerTxnAmt()).append("\",")
                .append("\"").append(vo.getOrderFeeAmt()).append("\",")
                .append("\"").append(vo.getPayChannel()).append("\",")
                .append("\"").append(vo.getSplitType()).append("\",")
                .append("\"").append(vo.getSplitStatus()).append("\"")
                .append("\r\n");
    }
    
    public String getFtpCsvContent() {
        StringBuilder sb = new StringBuilder(csvFtpFirstLine);
        sb.append("\r\n").append(csvFtpFirstLineContent.toString());
        sb.append(csvFtpSecondLine);
        sb.append("\r\n").append(csvFtpSecondLineContent.toString());
        return sb.toString();
    }
}
